﻿CREATE TABLE [dbo].[Paciente]
(
	[Rut] VARCHAR(15) NOT NULL PRIMARY KEY,
	[Nombre] VARCHAR(20) NOT NULL,
	[ApellidoPaterno] VARCHAR(20) NOT NULL,
	[ApellidoMaterno] VARCHAR(20) NOT NULL,
	[Sexo] char NOT NULL,
	[FechaNacimiento] Datetime not null,
	[Telefono] VARCHAR(12) null,
	[Direccion] VARCHAR(12) null,
	[Prevision] VARCHAR(12) null,
)

CREATE TABLE [dbo].[Medico]
(
	[Rut] VARCHAR(15) NOT NULL PRIMARY KEY,
	[Nombre] VARCHAR(20) NOT NULL,
	[ApellidoPaterno] VARCHAR(20) NOT NULL,
	[ApellidoMaterno] VARCHAR(20) NOT NULL,
	[Sexo] char NOT NULL,
	[FechaNacimiento] datetime not null,
	[Telefono] VARCHAR(12) null,
	[Direccion] VARCHAR(12) null,
	[Especialidad] VARCHAR(35) not null,
)

CREATE TABLE [dbo].[Enfermeria]
(
	[Rut] VARCHAR(15) NOT NULL PRIMARY KEY,
	[Nombre] VARCHAR(20) NOT NULL,
	[ApellidoPaterno] VARCHAR(20) NOT NULL,
	[ApellidoMaterno] VARCHAR(20) NOT NULL,
	[Sexo] char NOT NULL,
	[FechaNacimiento] datetime not null,
	[Telefono] VARCHAR(12) null,
	[Direccion] VARCHAR(256) null,
)

CREATE TABLE [dbo].[Urgencia]
(
	[ID] INT IDENTITY (1,1) NOT FOR REPLICATION PRIMARY KEY,
	[RutPaciente] VARCHAR(15) NOT NULL,
	[Especialidad] VARCHAR(35) NOT NULL,
	[Diagnostico] VARCHAR(256) NOT NULL,
	[Prioridad] VARCHAR(20),
	[Encargado] VARCHAR(15) not null,
	[FechaHora] datetime null
)

CREATE TABLE [dbo].[Usuario]
(
	[Username] NCHAR(5) NOT NULL PRIMARY KEY,
	[Pass] nchar(5) NOT NULL,
)

CREATE TABLE [dbo].[Prevision]
(
	[ID] int identity (1,1) not for replication primary key;
	[Nombre] varchar(15) not null;
)

insert into Usuario(Username,Pass)Values('admin','admin')

